import { $get } from '@js/request'
import { PerformanceSchema, WorkPerformanceSchema } from '@src/components/schema/performanceSchema'

// 获取评估数据
export async function getPerformanceRequest (id: string): Promise<PerformanceSchema> {
  const res = await $get(`/api/commission/performance/${id}`)
  return res.data
}

// 获取work
export async function getWorkById (performanceid: string, id: string): Promise<WorkPerformanceSchema | null> {
  const res = await $get('/api/commission/performance_work', {
    performanceid,
    condition: JSON.stringify([{ k: 'accountid', o: '=', v: id }])
  })
  const list = res.data
  if (list.length > 0) {
    return list[0]
  }
  return null
}
